class Message {

  User user
  String content
  String medium
  String ip
  String metaInfo
  String link
  Date dateCreated = new Date()
  Boolean enabled = true
  Boolean isPrivate = false

  static belongsTo = [user: User]

  static constraints = {
    user(nullable: false)
    content(nullable: false, blank: false, maxSize: 255)
    medium(nullable: false, blank: false, maxSize: 64)
    ip(nullable: true, blank: false, maxSize: 64)
    metaInfo(nullable: true)
    link(nullable: true, unique: true, blank: false)
    dateCreated(nullable: false)
    enabled(nullable: false)
    isPrivate(nullable:false)
  }

  static mapping = {
    sort dateCreated:"desc"
  }
}
